package sort;

import java.util.Arrays;

/**
 * ClassName: Bubble
 * Package: sort
 * Description:
 *
 * @Author fjorid
 * @Create 2025/2/18 19:12
 * @Version 1.0
 */
public class BubbleSort {
    public static void main(String[] args) {
        int[] arry = {11,5,4,9,8,2,3,7,6,-5,-9,0};
        bubbleSort(arry);
        System.out.println(Arrays.toString(arry));
    }
    public static void bubbleSort(int arry[]){
        for (int i = 0; i < arry.length-1; i++) {
            for (int j = 0; j < arry.length-1-i; j++) {
                if(arry[j] < arry[j+1]){//改变排序顺序只要改变这个不等号就行
                    int temp = arry[j];
                    arry[j] = arry[j+1];
                    arry[j+1] = temp;
                }

            }

        }

    }
}
